enum Color {
  Red = 10001,
  Yellow,
  Green = 456,
}
// console.log(Color.Green);

// for (let i = 0; i < 10; i++) {
//   setTimeout(function () {
//     console.log(i);
//   }, 100 * i);
// }

function foo() {
  // okay to capture 'a'
  console.log(a);
  return a;
}

// 不能在'a'被声明前调用'foo'
// 运行时应该抛出错误
foo();

let a = 1;

// 展开实例时 会丢失方法 所以 ,这是深拷贝？

class A {
  name: "A";
  getName() {
    return this.name;
  }
}

let c = new A();
// const clone = { ...c };
const clone = JSON.parse(JSON.stringify(c));
// console.log(c, clone.getName());

const objA = {
  name: "Lee Lei",
  age: 10,
  family: {
    dad: "Lee Dalei",
    mum: "Wang Xiaoli",
  },
};
const objB = { ...objA }; // 第二级依旧是 浅拷贝
// const objB = JSON.parse(JSON.stringify(objA));
objB.age = 36;
objB.family.dad = "Guo Juxia";
console.log(objA, objB);
